package view;

import java.awt.Color;

import javax.swing.JPanel;

import model.Day;
import model.TimeSlot;

/**
 * This class encompasses all behavior and variables that are common
 * to all cells.
 * 
 * @author Tristan D. Boucher
 * @version Commit #22 9/14/2013
 */
@SuppressWarnings("serial")
public abstract class AbstractCell extends JPanel implements CellInterface 
{
  /**
   * The constant for Yellow that corresponds to a selected timeslot.
   */
  protected static final Color SELECTED = Color.YELLOW;

  /**
   * The constant for Green that corresponds to a preferred timeslot.
   * By default a preferred timeslot is a selected timeslot.
   */
  protected static final Color PREFERRED = Color.GREEN.darker();

  /**
   * The constant for Red that corresponds to a not selected timeslot.
   */
  protected static final Color NOT_SELECTED = Color.RED.darker();

  /**
   * The color of this cell. Guaranteed to be one of the 3 color 
   * constants.
   */
  protected Color my_color;
  
  /**
   * The day that corresponds to this cell.
   */
  protected Day my_day;

  /**
   * The timeslot object for this cell.
   */
  protected TimeSlot my_slot;
  
  //Constructor
  /**
   * Initializes the state of the Timeslot and the current cell's color.
   * 
   * @param the_color The cell's color.
   * @param the_slot The timeslot for this cell.
   */
  public AbstractCell(final Color the_color, final TimeSlot the_slot)
  {
    this(the_slot);    
    my_color = the_color;
  }
  
  /**
   * Initializes the timeslot variable.
   * @param the_slot The timeslot that's associated with this cell.
   */
  public AbstractCell(final TimeSlot the_slot)
  {
    super();
    my_slot = the_slot;
  }
  
  /**
   * Returns the timeslot associated with this cell.
   * @return my_slot
   */
  public TimeSlot getTime()
  {
    return my_slot;
  }
}
//End of class AbstractCell.